import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ytbusiness/config/style.dart';
import 'package:ytbusiness/utils/helper.dart';
import 'package:ytbusiness/utils/screen_adaptation.dart';
import 'package:ytbusiness/widgets/widgets.dart';

class AccountSetting extends StatefulWidget {
  @override
  _AccountSettingState createState() => _AccountSettingState();
}


//账号设置
class _AccountSettingState extends State<AccountSetting> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: customAppBar(context,title: "账号设置"),
      backgroundColor: YTStyle.bgColor,
      body: Container(
        margin: EdgeInsets.only(top: setWidth(15)),
        color: Colors.white,
        child: ListView(
          shrinkWrap: true,
          children: [
            _itemWidget(
              titleStr: '登录密码',
              promptStr: '修改',
              onTap: () async {
                urlPush(context, "yuntu://modify_password");

              },
            ),
            _itemWidget(
              titleStr: '账号绑定管理',
              promptStr: '绑定/解绑',
              onTap: () {
                print('账号绑定管理 点击事件!!!');
              },
            ),
            _itemWidget(
              titleStr: '修改手机号',
              promptStr: '132****0214',
              onTap: () async {
                print('修改手机号 点击事件!!!');
                urlPush(context, "yuntu://modify_mobile_phone_number");
              },
            ),
            _itemWidget(
              titleStr: '修改邮箱',
              promptStr: 'ttm@163.com',
              onTap: () async {
                urlPush(context, "yuntu://modify_mailbox");
              },
            ),
          ],
        ),
      ),
    );
  }

  Widget _itemWidget({
    String titleStr,
    String promptStr,
    GestureTapCallback onTap,
  }) {
    return InkWell(
      onTap: onTap,
      child: Container(
        height: setWidth(60),
        margin: EdgeInsets.symmetric(horizontal: setWidth(15)),
        decoration: BoxDecoration(
          color: Colors.white,
          border: Border(
            bottom: BorderSide(
              width: setWidth(0.5),
              color: Color(0xfff0f0f0),
            ),
          ),
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text(
              titleStr,
              style: TextStyle(
                color: Color(0xff323232),
                fontSize: setSp(15),
              ),
            ),
            Row(
              children: [
                Text(
                  promptStr,
                  style: TextStyle(
                    color: Color(0xff989898),
                    fontSize: setSp(15),
                  ),
                ),
                SizedBox(
                  width: setWidth(8),
                ),
                Image.asset(
                  'assets/images/right_go.png',
                  width: setWidth(9),
                  height: setWidth(16.5),
                  fit: BoxFit.fill,
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
